package com.itfenghuang.day15_作业;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class A02_服务端 {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(11112);
        FileOutputStream fos = new FileOutputStream("F:\\bbb\\a.txt");
        Socket at = ss.accept();
                while (true){
                    try {
                        InputStream is = at.getInputStream();
                        BufferedReader br = new BufferedReader(new InputStreamReader(is));
                        String s = br.readLine();
                        fos.write(s.getBytes());
                        System.out.println(s);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }

    }
}
